from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from game.inventory.models import itemInstance
from game.inventory.models import equipedItems
from game.monster.models import individual
from game.monster.views import getIndThumb

@login_required
def equipItems(request):
		response = HttpResponse()
		response.write("Hello %s %s"%(request.user, vars))
		if request.method == 'GET':
			try:
				indID = request.GET["ind"]
				ind = individual.objects.get(id=indID, 
					user = request.user)
				response.write(getIndThumb(request, indID))
			except Exception, e:
				response.write("Sorry, that monster doesn't exist or doesn't belong to you")
				response.write(e)
				return response
			
			inventory = itemInstance.objects.filter(user = request.user)
			current_items = equipedItems.objects.filter(individual = ind)
			traits= ind.traits
			response.write("<b>Traits:</b><br>")
			for x in traits:
				response.write(x.name)
				response.write("<br>")
		
		return response
